<!DOCTYPE html>  
<html lang="zh-CN">  
<head>  
<meta charset="UTF-8">  
<title>产品规格表格 - 美化版</title> 
<script src="/static/js/jquery.min.js"></script>
<style>  
body{
    padding: 0px;
    margin: 0px;
}
/* 表格样式 */  
.caption{
    border: 1px solid #666;
    background-color: #fff;
    margin: 0px auto;
    /* position: absolute;
    top: 20%;
    left: 50%;
    margin-left: -450px;
    z-index: 1001;    
    display: none; */
}
.caption caption{
    text-align: left;
    text-indent:1em;
    height: 30px;
    line-height: 30px;
}
.caption thead{
    border-bottom:1px solid #333;
}
.caption tr td{
    width: 300px;
    height: 40px;
    line-height: 40px;
    border: none;
}
.caption tr td input{
    width: 160px;
    display: inline-block;
    border: none;
    text-align: center;
    background-color: #f5f5f5;
    color: #222;
    height: 30px;
    line-height: 30px;
    margin-left: 5px;
}
.caption tr td label{
    width: 120px;
    height: 30px;
    line-height: 30px;
    display: inline-block;
    text-align: right;
}
.caption tfoot tr td{
    border-top: 1px solid #888;
    height: 45px;
    text-align: center;
}
.caption tfoot td p{
    margin: 0px;
    width: 94%;
    padding: 0px 3%;
    text-align: right;
}
.caption tfoot tr td button{
    background-color: #1Accee;
    color: #fff;
    border: 1px solid #1Acca1;
    border-radius: 10px;
    height: 30px;
    line-height: 30px;
    width: 200px;
    font-size: 16px;
}
.black-mask{
    width: 100vw;
    height: 100vh;
    top:0px;
    left: 0px;
    position:fixed;
    z-index: 1000;
    background: rgba(0,0,0,0.4);
    display: none;
}
.left{
    position: fixed;
    top:10%;
    left: 20px;
    width: 120px;
    background-color: #f5f5f5;
    border: 1px solid #999;
    border-bottom: none;
}
.left div{
    width: 120px;
    height: 30px;
    border-bottom: 1px solid #999;
    text-align: center;
}
.left div a{
    display: block;
    height: 30px;
    line-height: 30px;
    color: #999;
    font-size: 16px;
    text-decoration: none;
}
.content{
    padding:30px 0px;
    width: 90%;
    margin: 0px auto;
    border-left: 1px solid #666;
    border-right: 1px solid #666;
    border-bottom: 1px solid #666;
}
.goods{
    width: 900px;
    margin: 15px auto;
}

.goods div[class="jieguo"]{
    width: 850px;
    text-align: right;
    height: 25px;
    line-height: 25px;
    margin: 0px;
    background-color:#FFF;
    color:#444;
    margin-right: 50px;
}

.goods div[class="goods-caption"]{
    width: 900px;
    margin: 10px auto;
    height: 30px;
    line-height: 30px;
    font-size: 18px;
    color: #030303;
    text-align: center;
}

.goods div[class="goods-info"]{
    width: 900px;
    border: 1px solid #999;
    display: block;
    height: auto;
    margin: 15px auto;
}
.goods div[class="cpation"]{
    background-color: #1Acca1;
    color:#fff;
    font-size: 18px;
    text-indent: 2em;
    width: 200px;
    height: 25px;
    line-height: 25px;
    margin: 0px;
    display: block;
}
.goods div{
    display: inline-block;
    width: 400px;
    height: 50px;
    line-height: 50px;
    margin: 10px;
}
.goods div label{
    text-align: center;
    width: 150px;
    display: inline-block;
    height: 30px;
    line-height: 30px;
}
.goods div input{
    width: 200px;
    height: 30px;
    line-height: 30px;
}
.goods div select{
    width: 200px;
    height: 30px;
    line-height: 30px;
    text-align: center;
}
div[class="hide"]{
    display: none;
}
#strand_list{
    display: none;
}
#strand_data{
    display: none;
}
table{

}
.table-message {  
    margin:20px auto;
    border-collapse: collapse;  
    width: 95%;  
}  
.table-message th, td {  
    border: 1px solid black;  
    padding: 8px;  
    text-align: left;  
}  
.table-message th {  
    background-color: #f2f2f2;  
}  
.logo {  
    text-align: center;  
}  
.footer {  
    text-align: right;  
}  
/* 表头样式 */  
</style>  
</head>  
<body>  
<div class="black-mask"></div>
<div class="left">
    <div><a href="#caption">客户信息</a></div>
    <div><a href="#goods">产品信息</a></div>
    <div><a href="#strand_list">毛胚信息</a></div>
    <div><a href="#weight-info">重量信息</a></div>
    <div><a href="#caption">价格参数</a></div>
    <div><a href="#table-message">模板参数</a></div>
</div>
<div class="content">
    <table class="caption" id="caption">
        <caption>报价编号:<b>{$data.order_no}</b></caption>
        <thead>
            <tr>
                <th>询价方</th>
                <th>报价方</th>
                <th>其他信息</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>
                    <label for="company_name">客户公司</label>
                    <input id="company_name" name="company_name" type="text">
                    
                </td>
                <td><label for="name">报价公司</label><input id="name" type="text" value="龙安法兰公司" disabled></td>
                <td><label for="end_time">报价有效期</label><input id="end_time" name="end_time" type="date"></td>
            </tr>
            <tr>
                <td><label for="company_address">公司地址</label><input type="text" id="company_address"></td>
                <td><label for="address">公司地址</label><input id="address" type="text" value="浙江温州龙湾" disabled></td>
                <td><label for="delivery_date">交货日期</label><input id="delivery_date" type="date" value=""></td>
            </tr>
            <tr>
                <td><label for="company_contacts">询价联系人</label><input id="company_contacts" type="text"></td>
                <td><label for="contact">业务联系人</label><input id="contact" type="text" value="杨天津" disabled></td>
                <td><label for="quoter">报价员</label><input id="quoter" type="text" value=""></td>
            </tr>
            <tr>
                <td><label for="company_mobile">联系方式</label><input id="company_mobile" type="text"></td>
                <td><label for="mobile">联系方式</label><input id="mobile" type="text"></td>
                <td><label for="auditor">审核员</label><input id="auditor" type="text" value="杨天津" disabled></td>
            </tr>
        </tbody>
        <tfoot>
            <tr>
                <td colspan="3">
                    <p>报价日期:{$data.day}</p>
                </td>
            </tr>
            <!-- <tr>
                <td colspan="3">
                    <button onclick="save_commpnay_data()">保存</button>
                    <button onclick="none_commpnay_data()">取消</button>
                </td>
            </tr> -->
        </tfoot>
    </table>
    <div class="goods" id="goods">
        <!-- <div class="goods-caption">产品1 <a href="javascript:;">v</a></div> -->
        <div class="goods-info">
            <div class="cpation">产品信息</div>
            <div>
                <label for="goods_standard">产品标准</label>
                <select id="goods_standard" name="goods_standard" onchange="set_goods_name(this.value)">
                    <option value="HG/T20592-2009">HG/T20592-2009</option>
                    <option value="HG/T20615-2009">HG/T20615-2009</option>
                    <option value="非标法兰">非标法兰</option>
                </select>
            </div>
            <div>
                <label for="goods_name">产品名称</label>
                <select name="goods_name" id="goods_name" onchange="set_goods_strand(this.value)">
                    <option value="对焊环松套法兰(PJ)">对焊环松套法兰(PJ)</option>
                    <option value="螺纹法兰(Th)">螺纹法兰(Th)</option>
                    <option value="承插焊法兰(SW)">承插焊法兰(SW)</option>
                    <option value="法兰盖(BL)">法兰盖(BL)</option>
                    <option value="对焊带颈法兰(WN)">对焊带颈法兰(WN)</option>
                    <option value="带颈平焊法兰(SO)">带颈平焊法兰(SO)</option>
                    <option value="平焊法兰(PL)">平焊法兰(PL)</option>
                </select>
            </div>
            <div id="goods_attr-div">
                <label for="goods_attr">规格</label>
                <input type="text" id="goods_attr" onkeydown="set_goods_blank()" onchange="set_goods_blank()" list="goods_attr_list">
                <datalist id="goods_attr_list">
                    {volist name="data.attr" id="value"} 
                    <option value="{$value.attr}">{$value.attr}</option>
                    {/volist}
                </datalist>
            </div>
            <div id="goods_pressure-div">
                <label for="goods_pressure">压力等级</label>
                <input type="text" id="goods_pressure" onkeydown="set_goods_blank()" onchange="set_goods_blank()" list="goods_pressure_list">
                <datalist id="goods_pressure_list">
                    {volist name="data.pressure" id="value"} 
                    <option value="{$value.pressure}">{$value.pressure}</option>
                    {/volist}
                </datalist>
            </div>
            <div id="goods_piping-div">
                <label for="goods_piping">系列</label>
                <input type="text" id="goods_piping" onkeydown="set_goods_blank()" onchange="set_goods_blank()" list="goods_piping_list">
                <datalist id="goods_piping_list">
                    {volist name="data.piping" id="value"} 
                    <option value="{$value.piping}">{$value.piping}</option>
                    {/volist}
                </datalist>
            </div>
            <div id="goods_ss-div">
                <label for="goods_ss">密封面</label>
                <input type="text" id="goods_ss" onkeydown="set_goods_blank()" onchange="set_goods_blank()" list="goods_ss_list">
                <datalist id="goods_ss_list">
                    {volist name="data.ss" id="value"} 
                    <option value="{$value.ss}">{$value.ss}</option>
                    {/volist}
                </datalist>
            </div>
            <div>
                <label for="goods_material">材质</label>
                <select name="goods_material" id="goods_material" onchange="set_material_data(this.value)">
                    <option value="304">304</option>
                    <option value="316L">316L</option>
                    <option value="2205">2205</option>
                    <option value="2507">2507</option>
                </select>
            </div>
            <div>
                <label for="goods_md">密度</label>
                <input id="goods_md" type="text" disabled>
            </div>
        </div>
        <div class="goods-info" id="strand_list">
            <div class="cpation">毛胚信息</div>
            <div>
                <label for="goods_pressing">锻压毛胚重量</label>
                <select name="goods_pressing" id="goods_pressing"></select>
            </div>
            <div>
                <label for="goods_price">毛胚不含税单价</label>
                <input type="text" id="goods_price" disabled>
            </div>
        </div>
        <div class="goods-info" id="strand_data">
            <div class="cpation">毛胚信息</div>
            <div class="hide" id="R1-div">
                <label for="R1">外径</label>
                <input type="number" id="R1" onchange="set_weight()" onkeydown="set_weight()" value=0>
            </div>
            <div class="hide" id="R2-div">
                <label for="R2">内孔</label>
                <input type="number" id="R2" onchange="set_weight()" onkeydown="set_weight()" value=0>
            </div>
            <div class="hide" id="H1-div">
                <label for="H1">片厚(不含台阶)</label>
                <input type="number" id="H1" onchange="set_weight()" onkeydown="set_weight()" value=0>
            </div>
            <div class="hide" id="R3-div">
                <label for="R3">台阶直径</label>
                <input type="number" id="R3" onchange="set_weight()" onkeydown="set_weight()" value=0>
            </div>
            <div class="hide" id="H2-div">
                <label for="H2">台阶高度</label>
                <input type="number" id="H2" onchange="set_weight()" onkeydown="set_weight()" value=0>
            </div>
            <div class="hide" id="H3-div">
                <label for="H3">总高</label>
                <input type="number" id="H3" onchange="set_weight()" onkeydown="set_weight()" value=0>
            </div>
            <div class="hide" id="R4-div">
                <label for="R4">根径</label>
                <input type="number" id="R4" onchange="set_weight()" onkeydown="set_weight()" value=0>
            </div>
            <div class="hide" id="R5-div">
                <label for="R5">对焊口直径</label>
                <input type="number" id="R5" onchange="set_weight()" onkeydown="set_weight()" value=0>
            </div>
            <div class="hide" id="R6-div">
                <label for="R6">壁厚</label>
                <input type="number" id="R6" onchange="set_weight()" onkeydown="set_weight()" value=0>
            </div>
            <div class="hide" id="N1-div">
                <label for="N1">孔数</label>
                <input type="number" id="N1" onchange="set_weight()" onkeydown="set_weight()" value=0>
            </div>
            <div class="hide" id="R7-div">
                <label for="R7">孔径</label>
                <input type="number" id="R7" onchange="set_weight()" onkeydown="set_weight()" value=0>
            </div>
            <div class="hide" id="A1-div">
                <label for="A1">外径余量</label>
                <input type="number" id="A1" onchange="set_weight()" onkeydown="set_weight()" value=0>
            </div>
            <div class="hide" id="A2-div">
                <label for="A2">内径余量</label>
                <input type="number" id="A2" onchange="set_weight()" onkeydown="set_weight()" value=0>
            </div>
            <div class="hide" id="A3-div">
                <label for="A3">片厚余量</label>
                <input type="number" id="A3" onchange="set_weight()" onkeydown="set_weight()" value=0>
            </div>
            <div class="hide" id="A4-div">
                <label for="A4">总高余量</label>
                <input type="number" id="A4" onchange="set_weight()" onkeydown="set_weight()" value=0>
            </div>
            <div class="hide" id="A5-div">
                <label for="A5">根径余量</label>
                <input type="number" id="A5" onchange="set_weight()" onkeydown="set_weight()" value=0>
            </div>
            <div class="hide" id="A6-div">
                <label for="A6">对焊口直径余量</label>
                <input type="number" id="A6" onchange="set_weight()" onkeydown="set_weight()" value=0>
            </div>
            <div>
                <label for="goods_forging_weight">锻打成品重量</label>
                <input type="text" id="goods_net_worth_weight" disabled>
            </div>
            <div>
                <label for="goods_forging_weight">锻打毛胚重量</label>
                <input type="text" id="goods_forging_weight" disabled>
            </div>
            <div>
                <label for="cutting_materials_weight">下料</label>
                <input type="text" id="cutting_materials_weight" disabled>
            </div>
            <div>
                <label for="goods_material_amount">圆钢材料单价</label>
                <input type="text" id="goods_material_amount" disabled>
            </div>
            <div>
                <label for="goods_cutting_amount">圆钢切费</label>
                <input type="text" id="goods_cutting_amount" disabled>
            </div>
            <div>
                <label for="goods_forging_amount">锻打加工费</label>
                <input type="text" id="goods_forging_amount" disabled>
            </div>
            <div>
                <label for="goods_loss_weight">锻打损耗费用</label>
                <input type="text" id="goods_loss_weight" disabled>
            </div>
            <div>
                <label for="goods_forging_price">锻打毛坯单价</label>
                <input type="text" id="goods_forging_price" disabled>
            </div>
            <div class="jieguo">总费用:<b id="goods_total_price3"></b></div>
        </div>
        <div class="goods-info" id="weight-info">
            <div class="cpation">重量参数</div>
            <div>
                <label for="goods_weight1">单毛重</label>
                <input type="text" id="goods_weight1" disabled>
            </div>
            <div>
                <label for="goods_weight2">单净重</label>
                <input type="text" id="goods_weight2" disabled>
            </div>
            <div>
                <label for="goods_weight3">废料重</label>
                <input type="text" id="goods_weight3" disabled>
            </div>
        </div>
        <div class="goods-info" id="number-info">
            <div class="cpation">数量参数</div>
            <div>
                <label for="goods_number">数量</label>
                <input type="number" id="goods_number" value="1">
            </div>
            <div>
                <label for="goods_unit">单位</label>
                <input type="text" id="goods_unit">
            </div>
        </div>
        <div class="goods-info" id="amount-info">
            <div class="cpation">费用参数</div>
            <div>
                <label for="goods_price1">固溶单价</label>
                <input type="number" id="goods_price1" value="0" onkeydown="get_total_price()" onchange="get_total_price()" disabled >
            </div>
            <div>
                <label for="goods_price2">固溶费用</label>
                <input type="number" id="goods_price2" value="0" onkeydown="get_total_price()" onchange="get_total_price()" disabled>
            </div>
            <div>
                <label for="goods_price3">探伤费用</label>
                <input type="number" id="goods_price3" value="0" onkeydown="get_total_price()" onchange="get_total_price()">
            </div>
            <div>
                <label for="goods_price4">运费单价</label>
                <input type="number" id="goods_price4" value="0" onkeydown="get_total_price()" onchange="get_total_price()">
            </div>
            <div>
                <label for="goods_price5">运费</label>
                <input type="number" id="goods_price5" value="0" onkeydown="get_total_price()" onchange="get_total_price()">
            </div>
            <div>
                <label for="goods_pricH1">加工费</label>
                <input type="number" id="goods_pricH1" value="0" onkeydown="get_total_price()" onchange="get_total_price()">
            </div>
            <div class="jieguo">总费用:<b id="goods_total_price1"></b></div>
        </div>
        <div class="goods-info" id="main-data">
            <div class="cpation">内部参数</div>
            <div>
                <label for="goods_price7">车工费用</label>
                <input type="number" value="0" id="goods_price7" onkeydown="get_total_price1()" onchange="get_total_price1()">
            </div>
            <div>
                <label for="goods_price8">包装费用</label>
                <input type="number" value="0" id="goods_price8" onkeydown="get_total_price1()" onchange="get_total_price1()">
            </div>
            <div>
                <label for="goods_price9">管理费用</label>
                <input type="number" value="0" id="goods_price9" onkeydown="get_total_price1()" onchange="get_total_price1()">
            </div>
            <div>
                <label for="goods_price10">税款</label>
                <input type="number" value="0" id="goods_price10" onkeydown="get_total_price1()" onchange="get_total_price1()">
            </div>
            <div>
                <label for="goods_price11">业务提成</label>
                <input type="number" value="0" id="goods_price11" onkeydown="get_total_price1()" onchange="get_total_price1()">
            </div>
            <div>
                <label for="goods_price12">利润</label>
                <input type="number" value="0" id="goods_price12" onkeydown="get_total_price1()" onchange="get_total_price1()">
            </div>
            <div>
                <label for="info">利润</label>
                <input type="text" id="info">
            </div>
            <div class="jieguo">总费用:<b id="goods_total_price2"></b></div>
        </div>
        <div class="button_div" style="width: 900px;text-align: right;">
            <button style="border: none;border-radius:10px;width: 200px;height: 40px;line-height: 40px;margin-right: 40px;background-color: #1Acca1;color: #f5f5f5;" onclick="add_goods()">添加</button>
        </div>
    </div>
    <table class="caption">
        <thead>
            <tr>
                <td>产品名称</td>
                <td>产品明细</td>
                <td>材质</td>
                <td>数量</td>
                <td>单位</td>
                <td>单重</td>
                <td>总重</td>
                <td>单价</td>
                <td>总价</td>
                <td>备注</td>
                <td>操作</td>
            </tr>
        </thead>
        <tbody id="list-message">
            
        </tbody>
    </table>
</div> 
<table class="table-message" id="table-message">  
    <tr>  
        <td class="logo" rowspan="3" style="vertical-align: middle;">  
            <!-- 在这里插入公司LOGO图片，例如：<img src="company_logo.png" alt="公司LOGO"> -->  
            公司LOGO  
        </td>  
        <td colspan="9" style="text-align: center;">  
            <h2>温州市龙安法兰有限公司</h2>  
        </td>  
    </tr>  
    <tr> 
        <td colspan="3">询价方</td>  
        <td colspan="3">报价方</td>  
        <td colspan="3">报价日期：</td>  
    </tr>  
    <tr>  
        <td colspan="3">客户公司：</td>  
        <td colspan="3">报价公司：</td> 
        <td colspan="3">交货期：</td>  
    </tr>  
    <tr> 
        <td></td>
        <td colspan="3">公司地址：</td>  
        <td colspan="3">公司地址：</td>  
        <td colspan="3">报价员：</td>  
    </tr>  
    <tr>  
        <td></td>
        <td colspan="3">联系人：</td>  
        <td colspan="3">联系人：</td>  
        <td colspan="3">审核员：</td>  
    </tr>  
    <tr> 
        <td></td>
        <td colspan="3">联系方式：</td>  
        <td colspan="3">联系方式：</td> 
        <td colspan="3"></td> 
    </tr>  
    <tr>  
        <th>产品名称</th>  
        <th>产品明细</th>  
        <th>材质</th>  
        <th>数量</th>  
        <th>单位</th>  
        <th>单重</th>  
        <th>总重</th>  
        <th>单价</th>  
        <th>总价</th>  
        <th>备注</th>  
    </tr>  
    <!-- 以下是产品信息的空行，您可以根据实际需要添加更多行 -->  
    <tr>  
        <td></td>  
        <td></td>  
        <td></td>  
        <td></td>  
        <td></td>  
        <td></td>  
        <td></td>  
        <td></td>  
        <td></td>  
        <td></td>  
    </tr>  
    <!-- ... 更多产品信息行 ... -->  
    <tr>  
        <th>合计</th>  
        <td colspan="8"></td>  
        <td></td>  
    </tr>  
    <tr>  
        <td colspan="10" style="text-align: left;">  
            1、此金额含增值税（13%）的人民币<br>  
            2、运费说明：以上价格含陆运运费。<br>  
            3、付款条件：协商。<br>  
            4、付款要求：只接受支票、电汇、转账，不收期票和银行承兑汇票。  
        </td>  
    </tr>  
    <tr>  
        <td colspan="10" class="footer">  
            单位报价章：<br>  
            Unit quotation seal：<br>  
            审核：<br>  
            本报价请购方签字盖章后生成订单<br>  
            Review: the order will be generated after the buyer signs and seals the price  
        </td>  
    </tr>  
</table>

<script>
    var weight = 0,
    goods_message_list = [],
    md = 0,
    goods_standard_name = '',
    gurongjiao = 0,
    goods_total_price = 0,
    goods_total_price1 = 0,
    goods_total_amount = 0,
    type_list = {
        'HG/T20592-2009' : ['平焊法兰(PL)','带颈平焊法兰(SO)','对焊带颈法兰(WN)','法兰盖(BL)','承插焊法兰(SW)','螺纹法兰(Th)','对焊环松套法兰(PJ)'],
        'HG/T20615-2009' : ['带颈平焊法兰(SO)','对焊带颈法兰(WN)','法兰盖(BL)','承插焊法兰(SW)','螺纹法兰(Th)','对焊环松套法兰(PJ)'],
        '非标法兰' : ['平焊法兰','带颈平焊法兰','对焊法兰','法兰盖','方法兰','椭圆法兰','平板法兰']
    },
    material = ['304','316L','2205','2507'],
    material_value = {
        '304':{'md':7.93,'duanda_name':'260锤加工费','duanda_amount':2.7,'gurongjiao':0.8,'amount' :0.5,'pale':1.05,'loss' : 0.15,'price':12.06,'geban':13.5,'juanban':14.2,'feiliao':9},
        '316L':{'md':7.93,'duanda_name':'400气锤加工费','duanda_amount':3.2,'gurongjiao':0.8,'amount' :0.55,'pale':1.065,'loss' : 0.2,'price':21.51,'geban':23.7,'juanban':24.4,'feiliao':16.5},
        '2205':{'md':7.93,'duanda_name':'皮带锤加工费','duanda_amount':3.5,'gurongjiao':1,'amount' :0.9,'pale':1.07,'loss' : 0.23,'price':23.04,'geban':26.5,'juanban':27,'feiliao':16.5},
        '2507':{'md':8.03,'duanda_name':'碾环加工费','duanda_amount':1.8,'gurongjiao':1.5,'amount' :1.2,'pale':1.15,'loss' : 0.3,'price':29.7,'geban':34,'juanban':35,'feiliao':17.5}
    };
    starnd_list = {
        //外径R1 内孔 R2 片厚 H1 台阶直径 R3 台阶高度 H2 总高 H3 根径 R4 对焊口直径 R5 壁厚 R6 孔数 N1 孔径 R7 外径余量 A1 内径余量 A2 片厚余量 A3 总高余量 A4 根径余量 A5 对焊口直径余量 A6
        '平焊法兰':['R1','R2','H1','R3','N1','R7','A1','A2','A3'],
        '带颈平焊法兰':['R1','R2','H1','R3','H2','H3','R4','R5','R6','N1','R7','A1','A2','A3','A4','A5','A6'],
        '对焊法兰':['R1','R2','H1','R3','H2','H3','R4','R5','N1','R7','A1','A2','A3','A4','A5','A6'],
        '法兰盖':['R1','N1','R7','A1','A3'],
        '方法兰':['R1','R2','H1','R3','N1','R7','A1','A2','A3'],
        '椭圆法兰':['R1','R2','H1','R3','N1','R7','A1','A2','A3'],
        '平板法兰':['R1','R2','H1','R3','N1','R7','A1','A2','A3']
    }
    goods_name = document.getElementById('goods_name');
    set_goods_name('HG/T20592-2009');
    set_material_data('304');
    function set_goods_name(value){
        let list = type_list[value],string = '';
        console.log(list);
        list.forEach(item => {
            string += '<option value="' + item + '">' + item + '</option>'
        });
        goods_name.innerHTML = string;
        if(value == '非标法兰'){
            // strand_data
            document.getElementById('goods_attr-div').style = 'display:none';
            document.getElementById('goods_pressure-div').style = 'display:none';
            document.getElementById('goods_piping-div').style = 'display:none';
            document.getElementById('goods_ss-div').style = 'display:none';
            document.getElementById('strand_data').style = 'display:block';
            document.getElementById('strand_list').style = 'display:none';
        }else{
            document.getElementById('goods_attr-div').style = 'display:inline-block';
            document.getElementById('goods_pressure-div').style = 'display:binline-lock';
            document.getElementById('goods_piping-div').style = 'display:inline-block';
            document.getElementById('goods_ss-div').style = 'display:inline-block';
            document.getElementById('strand_list').style = 'display:block';
            document.getElementById('strand_data').style = 'display:none';
        }
        set_goods_strand(list[0]);
    }
    function set_material_data(value){
        let data = material_value[value];
        md = document.getElementById('goods_md').value = data.md;
        gurongjiao = document.getElementById('goods_price1').value = data.gurongjiao;
        // goods_forging_weight
        document.getElementById('goods_material_amount').value = data.price;
        document.getElementById('goods_cutting_amount').value = data.amount;
        document.getElementById('goods_forging_amount').value = data.duanda_name + '-' + data.duanda_amount;
        document.getElementById('goods_loss_weight').value = data.loss;
        document.getElementById('goods_forging_price').value = Math.round(data.duanda_amount + data.loss + data.price + data.amount,2);
        get_total_price();
        get_total_price1();
    }
    function set_goods_strand(value){
        console.log(value);
        goods_standard_name = value;
        document.getElementById('goods_weight1').value = weight;
        document.getElementById('goods_price2').value = Math.round(weight * gurongjiao,4);
        get_total_price();
        get_total_price1();
        if(starnd_list[value]){
            starnd_list[value].forEach(item => {
                document.getElementById(item + '-div').style = 'display:inline-block';
            });
        }
        if(value == '带颈平焊法兰'){
            document.getElementById('R2').disabled  = true;
        }else{
            document.getElementById('R2').disabled  = false;
        }
    }

    function get_total_price(){
        let goods_price1 = parseFloat(document.getElementById('goods_price1').value),
        goods_price2 = parseFloat(document.getElementById('goods_price2').value),
        goods_price3 = parseFloat(document.getElementById('goods_price3').value),
        goods_price4 = parseFloat(document.getElementById('goods_price4').value),
        goods_price5 = parseFloat(document.getElementById('goods_price5').value),
        goods_pricH1 = parseFloat(document.getElementById('goods_pricH1').value);
        goods_total_price = goods_price1 + goods_price2 + goods_price3 + goods_price4 + goods_price5 + goods_pricH1;
        document.getElementById('goods_total_price1').innerText = goods_total_price;
        goods_total_amount = goods_total_price + goods_total_price1;
    }

    function get_total_price1(){
        let goods_price1 = parseFloat(document.getElementById('goods_price7').value),
        goods_price2 = parseFloat(document.getElementById('goods_price8').value),
        goods_price3 = parseFloat(document.getElementById('goods_price9').value),
        goods_price4 = parseFloat(document.getElementById('goods_price10').value),
        goods_price5 = parseFloat(document.getElementById('goods_price11').value),
        goods_pricH1 = parseFloat(document.getElementById('goods_price12').value);
        goods_total_price1 = goods_price1 + goods_price2 + goods_price3 + goods_price4 + goods_price5 + goods_pricH1;
        document.getElementById('goods_total_price2').innerText = goods_total_price1;
        goods_total_amount = goods_total_price + goods_total_price1;
    }

    function set_goods_blank(){
        let goods_data = {
            attr:document.getElementById('goods_attr').value,
            pressure:document.getElementById('goods_pressure').value,
            piping:document.getElementById('goods_piping').value,
            ss:document.getElementById('goods_ss').value
        },
        string = '';
        $.ajax({
            url: '/fdata', // 你的 PHP 脚本的 URL  
            type: 'post', // 请求类型，可以是 'GET' 或 'POST'  
            dataType: 'json', // 预期服务器返回的数据类型  
            data:goods_data,
            success: function(res) {
                console.log(res);
                if(res.code == 200){
                    res.data.forEach(item => {
                        string += '<option value="' + item.duanyazhongliang + '">' + item.changjia + '(' + item.duanyazhongliang + ')</option>';
                    });
                    weight = res.data[0].duanyazhongliang;
                    console.log(weight);
                    document.getElementById('goods_weight1').value = weight;
                }
                document.getElementById('goods_pressing').innerHTML = string;
                document.getElementById('goods_price2').value = Math.round(weight * gurongjiao,4);
            }
        });
    }

    function add_goods(){
        let goods = {},
            name = document.getElementById('goods_name').value,
            material = document.getElementById('goods_material').value,
            goods_attr = document.getElementById('goods_attr').value,
            goods_pressure = document.getElementById('goods_pressure').value,
            goods_piping = document.getElementById('goods_piping').value,
            goods_ss = document.getElementById('goods_ss').value,
            number = document.getElementById('goods_number').value,
            unit = document.getElementById('goods_unit').value,
            goods_weight1 = document.getElementById('goods_weight1').value;
            info = document.getElementById('info').value;
        let list = document.getElementById('list-message'),
            input_all = document.getElementsByTagName('input'),
            select_all = document.getElementsByTagName('select');
        console.log(input_all.length,select_all.length);
        for(let i=0;i<input_all.length;i++){
            goods[input_all[i].id] = input_all[i].value;
        }
        for(let i=0;i<select_all.length;i++){
            goods[select_all[i].id] = select_all[i].value;
        }
        goods_message_list.push(goods);
        let uniqid = generateSimpleUID();
        string = '<tr id="tr' + uniqid + '">';
        string += '<td>' + name + '</td>';
        string += '<td>' + goods_attr + '-' + goods_pressure + '-' + goods_piping + '-' + goods_ss + '</td>';
        string += '<td>' + material + '</td>';
        string += '<td>' + number + '</td>';
        string += '<td>' + unit + '</td>';
        string += '<td>' + goods_weight1 + '</td>';
        string += '<td>' + (goods_weight1 * number).toFixed(6) + '</td>';
        string += '<td>' + goods_total_amount + '</td>';
        string += '<td>' + Math.round(goods_weight1 * number * goods_total_amount,2) + '</td>';
        string += '<td>' + info + '</td>';
        string += '<td><a href="javascript:del_tr(\'' + uniqid + '\');">删除</td>'
        string += '</tr>';
        list.innerHTML += string;
    }

    function set_weight(){
        let R1 = parseFloat(document.getElementById('R1').value),
        R2 = parseFloat(document.getElementById('R2').value),
        H1 = parseFloat(document.getElementById('H1').value),
        R3 = parseFloat(document.getElementById('R3').value),
        H2 = parseFloat(document.getElementById('H2').value),
        H3 = parseFloat(document.getElementById('H3').value),
        R4 = parseFloat(document.getElementById('R4').value),
        R5 = parseFloat(document.getElementById('R5').value),
        R6 = parseFloat(document.getElementById('R6').value),
        N1 = parseFloat(document.getElementById('N1').value),
        R7 = parseFloat(document.getElementById('R7').value),
        A1 = parseFloat(document.getElementById('A1').value),
        A2 = parseFloat(document.getElementById('A2').value),
        A3 = parseFloat(document.getElementById('A3').value),
        A4 = parseFloat(document.getElementById('A4').value),
        A5 = parseFloat(document.getElementById('A5').value),
        A6 = parseFloat(document.getElementById('A6').value);
        console.log(goods_standard_name);
        if (goods_standard_name == '带颈平焊法兰'){
            R2 = (R5 - R6*2);
            document.getElementById('R2').value = R2;
        };
        console.log(R1,R2,H1,R3,H2,H3,R4,R5,R6,N1,R7,A1,A2,A3,A4,A5,A6);
        //外径R1 内孔 R2 片厚 H1 台阶直径 R3 台阶高度 H2 总高 H3 根径 R4 对焊口直径 R5 壁厚 R6 孔数 N1 孔径 R7 外径余量 A1 内径余量 A2 片厚余量 A3 总高余量 A4 根径余量 A5 对焊口直径余量 A6
        goods_weight1 = goods_net_worth_weight = (R1*R1/4*3.1415926*H1+R3*R3/4*3.1415926*H2+R4*R4/4+R4*R5/4+R5*R5/4*3.1415926*(H3-H1-H2))*md/1000000-R2*R2/4*3.1415926*md*H3/1000000-R7*R7/4*3.1415926*md*N1*R7/1000000;
        goods_forging_weight = ((R1+A1)*(R1+A1)/4*3.1415926*(H1+H2+A3)+(H3+A5)*(H3+A5)/4+(H3+A5)*(R5+A6)/4+(R5+A6)*(R5+A6)/4*3.1415926*(H3-H1-H2))*md/1000/1000-(R2-A2)*(R2-A2)/4*3.1415926*md*(H3+A4)/1000/1000;
        document.getElementById('goods_net_worth_weight').value = goods_net_worth_weight.toFixed(6);
        document.getElementById('goods_forging_weight').value = goods_forging_weight.toFixed(6);
        document.getElementById('cutting_materials_weight').value = (goods_forging_weight * 1.05).toFixed(6);
    }
    function del_tr(uniqid){
        document.getElementById('tr' + uniqid).remove();
    }
    function generateSimpleUID() {  
        const timestamp = Date.now(); // 获取当前时间戳  
        const randomNum = Math.random().toString(36).substring(7); // 生成一个随机的7位字符串  
        return timestamp + randomNum;  
    } 
</script>
</body>  
</html>